<template>
  <div>
    <el-dialog
      title=""
      :visible.sync="dialogVisible"
      width="68%"
      :before-close="handleClose"
      :fullscreen="fullscreen"
    > 
    <div slot="title" style="display: flex; justify-content: space-between;align-items: center;">
        <div>查询数据详情</div>
        <div style="margin-right: 30px; cursor: pointer;" @click="fullscreen = !fullscreen">
          <img style="width: 18px; height: 18px;" :src="!fullscreen ? require('../../../assets/icon/add.png'): require('../../../assets/icon/fix.png')" alt="">
        </div>
      </div>
      <div style="overflow-y: auto; height: 70vh">
        <div class="canpany-info">
          <div>公司名称:{{ detailInfo.enterpriseName }}</div>
          <div style="margin: 0 15px">
            注册地址:{{ detailInfo.registerAddress }}
          </div>
          <div>历史查询时间:{{ detailInfo.queryTime }}</div>
        </div>
        <div class="tabs" style="min-height: 500px">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="纳税金额" name="first">
              <payMoney
                ref="payMoneyRef"
                :isNeedList="true"
                :jobActive="jobActive"
                :jobStatus="jobStatus"
                :isNeedDate="false"
              ></payMoney>
            </el-tab-pane>
            <el-tab-pane label="开票金额" name="second">
              <reportSearch
                ref="reportSearchRef"
                :jobActive="jobActive"
                :jobStatus="jobStatus"
              ></reportSearch>
            </el-tab-pane>
            <el-tab-pane label="纳税信用" name="third">
              <DeclarationInformationVue
                ref="DeclarationInformationVueRef"
                :jobActive="jobActive"
                :jobStatus="jobStatus"
                :isNeedDate="false"
              ></DeclarationInformationVue>
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import * as tax from "@/api/tax";
import DeclarationInformationVue from "./DeclarationInformation.vue";
import payMoney from "./payMoney.vue";
import reportSearch from "./reportSearch.vue";
export default {
  components: {
    DeclarationInformationVue,
    payMoney,
    reportSearch,
  },
  data() {
    return {
      dialogVisible: false,
      detailInfo: {},
      activeName: "first",

      jobActive: "",
      jobStatus: null,
      fullscreen: false
    };
  },
  methods: {
    //   点击切换
    handleClick(v) {
      this.resetChildForm();
      if (v.index == 0) {
        this.$nextTick(() => {
          this.jobStatus == 200 && this.$refs.payMoneyRef.searchList();
          this.$refs.payMoneyRef.showFlag = false;
          this.$refs.payMoneyRef.restFormValite();
        });
      } else if (v.index == 1) {
        this.$nextTick(() => {
          this.jobStatus == 200 && this.$refs.reportSearchRef.searchList();
          this.$refs.reportSearchRef.showFlag = false;
        });
      } else if (v.index == 2) {
        this.$nextTick(() => {
          this.jobStatus == 200 &&
            this.$refs.DeclarationInformationVueRef.searchList();
          this.$refs.DeclarationInformationVueRef.showFlag = false;
          this.$refs.DeclarationInformationVueRef.restFormValite();
        });
      }
    },
    //   重置子组件表单
    resetChildForm() {
      this.$refs.payMoneyRef.total = 0;
      this.$refs.payMoneyRef.tableData = [];
      this.$refs.payMoneyRef.searchForm = {
        pageNum: 1,
        pageSize: 10,
        taxPeriodStart: "", //税款所属期起
        taxPeriodEnd: "", // 税款所属期止
        paymentDateEnd: "",
        paymentDateStart: "",
      };

      this.$refs.reportSearchRef.total = 0;
      this.$refs.reportSearchRef.tableData = [];
      this.$refs.reportSearchRef.searchForm = {
        pageNum: 1,
        pageSize: 10,
        applyStartTime: "", //税款所属期起
        applyEndTime: "", // 税款所属期止
      };
      this.$refs.DeclarationInformationVueRef.searchForm = {
        startTime: "",
        endTime: "",
      };
      this.$refs.DeclarationInformationVueRef.detailInfo = {};
      this.$refs.DeclarationInformationVueRef.canpanyInfo = {};
      this.$refs.DeclarationInformationVueRef.restFormValite();
      this.$refs.payMoneyRef.restFormValite();
    },

    handleClose() {
      // console.log(this.$refs.payMoneyRef);
      //重置表单
      this.resetChildForm();
      this.activeName = "first";
      this.dialogVisible = false;
    },
    //   弹框详情
    openDia(v) {
      this.detailInfo = v;
      this.jobActive = v.enterpriseId + "";
      this.jobStatus = v.status;
      this.dialogVisible = true;
      this.$nextTick(() => {
        this.jobStatus == 200 && this.$refs.payMoneyRef.searchList();
        this.$refs.payMoneyRef.showFlag = false;
        this.$refs.reportSearchRef.showFlag = false;
        this.$refs.DeclarationInformationVueRef.showFlag = false;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/ .el-dialog__body {
  padding: 0 30px 30px;
}
.canpany-info {
  width: 100%;
  height: 50px;
  background-color: #f3f9ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 12px;
  border-radius: 8px;
}
</style>